//
//  ZYCStuLeavePersonCell.m
//  ZDSC
//
//  Created by ZDTX on 2021/8/15.
//

#import "ZYCStuLeavePersonCell.h"
#import "ZYCRoleTreeModel.h"
#import "UIButton+EnlargeEdge.h"
@interface ZYCStuLeavePersonCell()

@property (nonatomic, strong) UIImageView *selectImageView;

@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UIImageView *arrowImageView;
@property (nonatomic, strong) UIView *line;
@end
@implementation ZYCStuLeavePersonCell

- (void)setModel:(ZYCRoleTreeModel *)model{
    _model = model;
    _titleLabel.text = model.label;
}

- (void)setIsSelect:(BOOL)isSelect{
    _isSelect = isSelect;
    if (isSelect) {
        self.selectImageView.image = [UIImage imageNamed:@"gx"];
    }else{
        self.selectImageView.image = [UIImage imageNamed:@"xzz"];
    }
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;

        [self.contentView addSubview:self.selectImageView];
        [self.contentView addSubview:self.titleLabel];
        [self.contentView addSubview:self.line];

        [self.selectImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(15.0f);
            make.centerY.equalTo(self.contentView);
            make.size.mas_equalTo(CGSizeMake(13, 13));
        }];
        
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.selectImageView.mas_right).offset(5.0f);
            make.centerY.equalTo(self.contentView);
        }];

        
        [self.line mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(15.0f);
            make.right.equalTo(self.contentView).offset(-15.0f);
            make.bottom.equalTo(self.contentView);
            make.height.mas_equalTo(0.5);
        }];
                
    }
    return self;
}

- (UIImageView *)selectImageView {
    if (!_selectImageView) {
        _selectImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"xzz"]];
    }
    return _selectImageView;
}


- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [UILabel LabelWithFont:kCustomFont(@"PingFangSC-Regular", 18) titleColor:HEX_RGB(@"333333") textAlignment:ZZTextAlignmentLeft];
    }
    return _titleLabel;
}


- (UIView *)line {
    if (!_line) {
        _line = [[UIView alloc] init];
        _line.backgroundColor = HEX_RGB(@"#DEDEDE");
    }
    return _line;
}

- (void)clickSelectAction:(UIButton *)sender{
    sender.selected = !sender.selected;
}


@end
